<template>
<div id="passwordreset">
    <div class="process-problem passwordreset">
        <div class="processit-title">
          <mt-header title="应用系统密码重置" class="mt-header">
             <mt-button icon="back" slot="left" class="back" @click="$root.goBack()">返回</mt-button>
         </mt-header>
        </div>
        <div class="replace"></div>
        <!-- <div class="complainmsg">
            
        </div> -->
         <div class="process-container">
             <ul>
                <li>
                    <p>系统类型</p>
                    <div class="button-sort systemsort">
                        <ul class="clearfix">
                            <li>
                                <a href="javascript:;">
                                    <img src="../assets/interact/it-OA-light.png" alt="">
                                    <span>OA</span>
                                </a> 
                            </li>
                             <li @click="noOpen">
                                <a href="javascript:;">
                                    <img src="../assets/interact/it-RDM.png" alt="">
                                    <span>RDM</span>
                                </a> 
                            </li>
                             <li @click="noOpen">
                                <a href="javascript:;">
                                    <img src="../assets/interact/it-PMS.png" alt="">
                                    <span>PMS</span>
                                </a> 
                            </li>
                             <li @click="noOpen">
                                <a href="javascript:;">
                                    <img src="../assets/interact/it-IDM.png" alt="">
                                    <span>IDM</span>
                                </a> 
                            </li>
                        </ul>
                    </div>
                </li>
             </ul>
             <div class="resetpwd">
                  <p class="title">重置OA密码</p>
                        <div class="newpwd">
                            <label for="">新密码：</label>
                            <input type="text" class="password" placeholder="请输入新密码" v-model="password">
                            <i class="delpwd" v-show="isshow" @click="delpwd"></i>
                        </div>
             </div>
        </div>
          <!-- 提交 -->
      <footer class="btnsubmit">
          <button @click="addItService">提交</button>
      </footer>
    </div>
</div>
</template>

<script>
import { Navbar, TabItem, MessageBox } from "mint-ui";
import { mapGetters, mapActions } from "vuex";
import service from "../service";
import config from "configuration";
export default {
  components: {
    Navbar,
    TabItem,
    MessageBox
  },
  name: "complain",
  data() {
    return {
      isshow: false,
      itSysName: "OA",
      itSysCode: 1,
      workcode: "",
      password: ""
    };
  },
  computed: {
    ...mapGetters({
      loading: "getLoading",
      direction: "getDirection"
    })
  },
  watch: {
    password: function(val) {
      if (val.length > 0) {
        this.isshow = true;
      } else {
        this.isshow = false;
      }
    }
  },
  methods: {
    noOpen() {
      MessageBox({
        title: "提示",
        message: "正在建设中",
        confirmButtonText:"我知道了"
      });
    },
    delpwd() {
      this.password = "";
    },
    addItService() {
      service.getUser().then(data => {
        var params = {};
        params.workcode = this.workcode = data.employeenumber;
        params.itSysName = this.itSysName;
        params.itSysCode = this.itSysCode;
        params.password = this.password;
        service.resetPwd(params).then(res => {
          if (res.code == 100) {
            console.log(res);
            alert("您的密码已重置");
          }
        });
      });
    }
  }
};
</script>
<style scoped>

</style>